package com.loong.service.impl;

import com.loong.mapper.ProductMapper;
import com.loong.mapper.impl.ProductMapperImpl;
import com.loong.pojo.PageBean;
import com.loong.pojo.Product;
import com.loong.service.ProductService;

import java.util.List;

public class ProductServiceImpl implements ProductService {

    @Override
    public PageBean<Product> findPage(String tid, int page, int pageSize) {
        ProductMapper productMapper = new ProductMapperImpl();
        long count = productMapper.selectCountByTid(tid);//查询总条数;
        List<Product> list = productMapper.selectProductByPage(tid,page,pageSize);
        return new PageBean<Product>(list,page,pageSize,count);
    }

    @Override
    public Product findProductByPid(int pid) {
        ProductMapper productMapper = new ProductMapperImpl();
         Product product = productMapper.selectProductByPid(pid);
         return product;
    }
}
